<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<%@include file="../userInfo_inc.jsp" %>
<body>
<h1>题目列表</h1>
<c:url var="toExcel_url" value="/project/graduateProjectToExcel.html"/>
<a href="${toExcel_url}">输出Excel文件</a>
<table border="1">	
	<c:forEach items="${graduateProjects}" var="graduateProject">
		<tr>
			<td>${graduateProject.title}<td>
			<td>${graduateProject.projectCategory.description}<td>
			<td>${graduateProject.projectType.description}<td>
			<td>${graduateProject.teacher.name}</td>
			<td>${graduateProject.teacher.title.description}</td>
			<td>${graduateProject.teacher.degree.description}</td>		
			<!-- 限选专业 -->
			<td>【
				<c:forEach items="${graduateProject.limitedToMajor}" var="major">
					${major.description}
				</c:forEach>
				】
			</td>
			<!-- 将id直接加入到url中 ，但一定要以html为扩展名-->
			<c:url var="edit_url" value="/project/updateGraduateProject/${graduateProject.id}.html">
			</c:url>			
			
			<c:url var="delete_url" value="/project/deleteGraduateProject/${graduateProject.id}.html">
			
			</c:url>			
			<td>			
			<!-- choose标签相当于if-else，平衡式的选择语句,而if标签只提供单向选择 -->
			<c:choose>
	      		<c:when test="${graduateProject.teacher==userInfo.teacher&&graduateProject.graduateProjectStatus.description!='批准'}">
	        		<a href="${edit_url}" >修改</a>	
					<a href="${delete_url}" >刪除</a>
		      	</c:when>
		      	<c:otherwise>
		      		<!-- 显示一个空格，否则会现单元格为空，有失美观 -->
		       		&nbsp
		       		${userInfo.teacher.id}/${graduateProject.teacher.id }/${graduateProject.graduateProjectStatus.description}
		      	</c:otherwise>
			</c:choose>		
			</td>	
		</tr>	
	</c:forEach>	
		
</table>
<c:url var="add_url" value="/project/toAddGraduateProject.html"/>
<a href="${add_url}">增加毕业设计题目</a>
<c:url var="showGraduateProjectList_url" value="/project/showGraduateProjectListJson.html"/>

<a href="${showGraduateProjectList_url}">显示毕业设计题目(JSON)</a>

</body>
</html>